QNW_TS_ServerCommand = LuaNet:getInstance().getModule(QNW_TS_Config.name, QNW_TS_Config.debug)

local this = QNW_TS_ServerCommand

this.addCommandHandler("online", function(_player, _time)
    QNW_TS_ServerCore.online(_player, _time)
end)

this.addCommandHandler("addZombie", function(_player, _x, _y, _z, _count, _type)
    QNW_TS_ServerOther.addZombie(_player, _x, _y, _z, _count, _type)
end)

this.addCommandHandler("randomReward", function(_player, _uuid, _type, _count)
    QNW_TS_ServerOther.randomReward(_player, _uuid, _type, _count)
end)

function QNW_TS_ServerCommand.registerTaskCategory(_taskCategory, _player)
    if LuaNet:getInstance().isRunning() then
        this.sendPlayer(_player, "registerTaskCategory", _taskCategory.Type)
    else
        QNW_TS_ClientCore.registerTaskCategory(_taskCategory)
    end
end

function QNW_TS_ServerCommand.unregisterTaskCategory(_taskCategory, _player)
    if LuaNet:getInstance().isRunning() then
        this.sendPlayer(_player, "unregisterTaskCategory", _taskCategory.Type)
    else
        QNW_TS_ClientCore.unregisterTaskCategory(_taskCategory)
    end
end

function QNW_TS_ServerCommand.releaseTask(_task, _player)
    if LuaNet:getInstance().isRunning() then
        this.sendPlayer(_player, "releaseTask", _task.Type)
    else
        QNW_TS_ClientCore.receiveTask(_task)
    end
end

function QNW_TS_ServerCommand.sendReward(_uuid, _rewards, _player)
    if LuaNet:getInstance().isRunning() then
        this.sendPlayer(_player, "sendReward", _uuid, _rewards)
    else
        QNW_TS_ClientCore.receiveReward(_uuid, _rewards)
    end
end